package com.yjd.pub.order.service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.comm.order.model.OrderNoFactoryModel;
import com.yjd.comm.order.service.IOrderNoFactoryService;
import com.yjd.pub.order.dao.IOrderNoFactoryDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * <b>description</b>：订单编号工厂表业务实现<br>
 * <b>time</b>：2017-08-17 13:05:17 <br>
 * <b>author</b>：  carl
 */
@Service("orderNoFactoryService")
public class OrderNoFactoryServiceImpl extends BaseServiceImpl implements IOrderNoFactoryService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public OrderNoFactoryModel insert(OrderNoFactoryModel model) throws Exception {
		return this.orderNoFactoryDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(OrderNoFactoryModel model) throws Exception {
		return this.orderNoFactoryDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param order_no
	 * @return
	 * @throws Exception
	 */
	public int delete(long order_no) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("order_no", order_no);
		return this.orderNoFactoryDao.deleteModel(paramMap, true);
	}

	@Resource
	private IOrderNoFactoryDao orderNoFactoryDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.orderNoFactoryDao;
	}

}
